package com.mojo.concurrent.waitandnotify;

/**
 * 线程练习：创建两个线程，分别遍历100以内的奇数和偶数
 *
 * @author <a href="mailto:mojo_jj@163.com">Mojo</a>
 */
public class ThreadDemo02 {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                if (i % 2 == 0) {
                    System.out.println(Thread.currentThread().getName() + ">>偶数>>" + i);
                }
            }
        });
        Thread t2 = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                if (i % 2 != 0) {
                    System.out.println(Thread.currentThread().getName() + ">>奇数>>" + i);
                }
            }
        });
        t1.start();
        t2.start();
    }
}
